import request from '@/utils/request'
// 获取树形结构根数据
export const getAssetTreeRootApi = (treeModel) =>
  request.get('/core/vom/device-tree/root-node/list', {
    params: {
      bizType: '',
      treeModel
    }
  })
// DeviceManageTree
// 获取树形结构数据
export const getAssetDataApi = (data) =>
  request.post('/core/vom/device-tree/child-node/list', data)

// 获取模型节点菜单列表数据（按钮）
export const getContextmenusApi = (params) =>
  request.get('/core/vom/page-view/context-menu', { params })

// 获取动态界面模型
export const getFacerootApi = (params) =>
  request.get('/core/vom/page-view', { params })

// 获取模型设备实体初始化数据加下拉
export const getViewDataApi = (params) =>
  request.get('/core/vom/page-view/elements/view', { params })

// 获取模型新增初始化数据+下拉选项
export const getAddDataApi = (params) =>
  request.get('/core/vom/page-view/elements/init', { params })

// 获取模型修改初始化数据+下拉选项
export const getEditDataApi = (params) =>
  request.get('/core/vom/page-view/elements/modify', { params })

// 新增设备
export const addEquipmentApi = (data) =>
  request.post('/core/vom/page-view/data/create', data, {
    headers: {
      'Content-Type': 'multipart/form-data' // 设置请求头的 Content-Type 为 multipart/form-data
    }
  })

// 修改设备
export const editEquipmentApi = (data) =>
  request.post('/core/vom/page-view/data/modify', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })

// 检验实体数据是否可删除
export const checkoutDataApi = (data) =>
  request.post('/core/vom/page-view/data/delete-check', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })

// 删除实体数据
export const delDataApi = (data) =>
  request.post('/core/vom/page-view/data/delete', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
// 搜索设备关键字过滤信息
export const getKeywordListApi = (params) =>
  request.get('/core/vom/device-tree/simple-device/list', { params })

// 获取模型级联下拉框数据
export const getChildComboApi = (params) =>
  request.get('/core/vom/page-view/child-combo-item', { params })

// 查询可移入上级设备下拉框列表
export const getMovetoListApi = (params) =>
  request.get('/core/vom/device-tree/move-to/combo-items', { params })

// 设备移动到新的设备层级下
export const moveDeviceApi = (data) =>
  request.post('/core/vom/page-view/data/move', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })

// 设备复制新增当前层级
export const copyDeviceApi = (data) =>
  request.post('/core/vom/page-view/data/copy-brother', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })

// 设备复制新增新层级
export const copyNewDeviceApi = (data) =>
  request.post('/core/vom/page-view/data/copy-create', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })

// 查询可引用设备列表
export const getRelationListApi = (params) =>
  request.get('/core/vom/device-tree/relation-simple-device/list', { params })

// 引用设备到当前设备层级下
export const createRelationApi = (data) =>
  request.post('/core/vom/page-view/data/create-relation', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })

// 删除设备引用关系

export const delRelationApi = (data) =>
  request.post('/core/vom/page-view/data/delete-relation', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
